package com.gxa.guahao01.controller;

import com.gxa.guahao01.pojo.GuaHaoJiLu;
import com.gxa.guahao01.service.GuaHaoJiLuServiceImpl;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 患者挂号记录(GuaHaoJiLu)表控制层
 *
 * @author xyc
 * @since 2021-03-17 10:53:41
 * @version 1.0
 */
@RestController
@RequestMapping("guaHaoJiLu")
@Api(value = "患者挂号记录(GuaHaoJiLu)管理",tags = "患者挂号记录(GuaHaoJiLu)管理接口API")
@ApiResponses({
        @ApiResponse(code=400,message="请求参数不完整或者错误"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=405,message="请求方式不正确，比如后台接收是post，但前端请求的是get"),
        @ApiResponse(code=406,message="页面地址和接口名冲突"),
        @ApiResponse(code=415,message="请求格式不正确，前端可能没有把请求头修改为json，也可能前端请求的json对象没有转换为字符串"),
        @ApiResponse(code=500,message="后台服务逻辑错误")
})
public class GuaHaoJiLuController {
    /**
     * 服务对象
     */
    @Resource
    private GuaHaoJiLuServiceImpl guaHaoJiLuServiceImpl;
    /**
     * 查询所有数据
     * @return 返回所有数据
     */
    @GetMapping("chaXunAll")
    @ApiOperation(value = "查询所有数据接口,可根据时间和接诊状态条件查询",notes = "查询所有数据接口",httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "kaiShiShiJian",value = "时间范围查询的开始时间",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "jieShuShiJian",value = "时间范围查询的结束时间",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "jieZhenJiLuZhuangTai",value = "接诊记录状态（0已退号，1待接诊，2接诊中，3已完成，4已过期）",paramType = "query",dataType = "String",required = false)
    })
    public Map<String, Object> chaXunAll(@RequestParam(value = "kaiShiShiJian",required = false) String kaiShiShiJian,
                                         @RequestParam(value = "jieShuShiJian",required = false) String jieShuShiJian,
                                         @RequestParam(value = "jieZhenJiLuZhuangTai",required = false) String jieZhenJiLuZhuangTai) {
        return this.guaHaoJiLuServiceImpl.chaXunAll(kaiShiShiJian,jieShuShiJian,jieZhenJiLuZhuangTai);
    }
    
    /**
     * 通过主键退号单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
      @PostMapping("tuiHaoById")
    @ApiOperation(value = "根据一个主键退号的接口",notes = "根据一个主键退号的接口",httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "主键",paramType = "query",dataType = "String",required = true),
    })
    public Map<String, Object> shanChuById(@RequestParam("id") String id) {
        return this.guaHaoJiLuServiceImpl.shanChuById(id);
    }
    
    /**
     * 通过主键更新单条数据
     *
     * @param guaHaoJiLu 一个数据库对应的POJO数据对象
     * @return 单条数据
     */
    @PostMapping("gengXinById")
    @ApiOperation(value = "通过主键更新一条挂号记录的接口",notes = "id为必传，其他字段传递需要修改的数据，传哪些修改哪些",httpMethod = "POST")
    public Map<String, Object> gengXinById(@RequestBody @ApiParam(name = "guaHaoJiLu",value = "pojo模型",required = true) GuaHaoJiLu guaHaoJiLu) {
        return this.guaHaoJiLuServiceImpl.gengXinById(guaHaoJiLu);
    }
    
    /**
     * 通过一个pojo对象新增单条数据
     *
     * @param guaHaoJiLu 一个数据库对应的POJO数据对象
     * @return 返回插入的主键id
     */
    @PostMapping("xinZeng")
    @ApiOperation(value = "根据完整记录新增一条挂号记录的接口",notes = "挂号员id必传，患者就诊卡xingMing和huanZheKaHao必传",httpMethod = "POST")
    public Map<String, Object> xinZeng(@RequestBody @ApiParam(name = "guaHaoJiLu",value = "pojo模型",required = true) GuaHaoJiLu guaHaoJiLu) {
        return this.guaHaoJiLuServiceImpl.xinZeng(guaHaoJiLu);
    }
//    @GetMapping("check")
//    public void check(){
//        this.guaHaoJiLuServiceImpl.check();
//    }



}